package name.matthewgreet.example4.view; import name.matthewgreet.example4.action.ViewGameListAction.GameCategory; import name.matthewgreet.example4.common.AbstractListDisplay; import name.matthewgreet.example4.common.ListCache; import name.matthewgreet.example4.dto.GameDTO; import name.matthewgreet.example4.util.FormatLibrary; public class GameListDisplay extends AbstractListDisplay<GameDisplay,GameDTO> { private GameCategory preferredCategory; private String preferredRankName; private boolean noSelectedItem; public GameListDisplay(ListCache<?,?,GameDTO> listCache, GameCategory preferredCategory) throws Exception { super(listCache); this.preferredCategory = preferredCategory; this.preferredRankName = FormatLibrary.formatGameCategory(preferredCategory); this.noSelectedItem = listCache.getSelectedIndex() < 0; } @Override protected GameDisplay formatRecord(GameDTO game) { return new GameDisplay(game, preferredCategory); } public String getPreferredRankName() { return preferredRankName; } public boolean getNoSelectedItem() { return noSelectedItem; } }